package com.wmada.spring.service;

import com.timerchina.base.ActionResult;
import com.wmada.spring.bean.User;
import org.springframework.data.domain.Page;

import java.util.List;

/**
 * @author will.ma
 * @date 2020-9-29
 */
public interface UserService {

    User get(Long id);

    ActionResult<User> add(User user);

    User update(User user);

    void delete(User user);

    List<User> list();

    Page<User> list(int page, int pageSize);

    User getUserById(Long id);

    User getUserByUsername(String username);

    User getUserByEmail(String emailAddress);

    User getUserByPhone(String phoneNumber);

    ActionResult<User> changePassword(User user, String oldPassword, String newPassword);

    void resetPassword(User user, String password);

    void updateLoginFailure(User user);

    void updateLoginSuccess(User user);

    void freeze(User user, boolean isFrozen);

    ActionResult<Void> duplicate(User user);

}
